package com.gnerv.rabbitmq.agent.model.entity;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@Data
public class NodeStatus {

    private String name;
    private String version;
    private String type;
    private String status;

    private FileDescriptor fileDescriptor = new FileDescriptor();
    private SocketDescriptor socketDescriptor = new SocketDescriptor();
    private ErlangProcesses erlangProcesses = new ErlangProcesses();
    private Memory memory = new Memory();
    private String memoryHighWatermark;
    private String memoryCalculationStrategy;
    private Disk disk = new Disk();
    private String os;
    private String erlangVersion;
    private List<Listener> listeners = Lists.newArrayList();
    private long uptime;

    @Data
    public static class Memory {
        private long used;
        private long limit;
    }

    @Data
    public static class Disk {
        private long free;
        private long limit;
    }

    @Data
    public static class FileDescriptor {
        private long used;
        private long limit;
    }

    @Data
    public static class SocketDescriptor {
        private long used;
        private long limit;
    }

    @Data
    public static class ErlangProcesses {
        private long used;
        private long limit;
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Listener {

        private String name;
        private String ip;
        private int port;
    }

}
